/*
 * @Author: xiawei 1243162387@qq.com
 * @Date: 2024-11-14 23:50:53
 * @LastEditors: xiawei 1243162387@qq.com
 * @LastEditTime: 2024-12-06 21:27:22
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import qiankun from 'vite-plugin-qiankun'
import postcss from 'postcss';
import prefixSelectors from 'postcss-prefix-selector';
const port = (process.env.port || 8003) as number
const isDev = process.env.NODE_ENV === 'development'
import { resolve } from 'path'
const pathSrc = resolve(__dirname, 'src')
// https://vite.dev/config/
export default defineConfig({
  plugins: [
    qiankun('vue3-vite-app', {
      useDevMode: true,
    }),
    //@ts-ignore
    vue(),
  ],
  base: isDev ? `http://localhost:5173/` : '/',
  server: {
    port: port,
    headers: {
      'Access-Control-Allow-Origin': '*',
    }
  },
  css: {
    postcss: {
      plugins: [
        prefixSelectors({
          prefix: '.vue3-vite-app', // 
          exclude: ['body', 'html', ':root']
        }),
      ],
    }
  },
})
